Skip to content

{AD} az ad: Update --filter argument's help message#25172

Draft
jiasli wants to merge 1 commit intoAzure:devfrom
jiasli:filter-arg
Draft

{AD} az ad: Update --filter argument's help message#25172
jiasli wants to merge 1 commit intoAzure:devfrom
jiasli:filter-arg

Conversation

@jiasli
Copy link
Copy Markdown
Member

@jiasli jiasli commented Jan 19, 2023

Related command
az ad

Description
--filter is defined on the whole az ad scope, so whenever a command under az ad supports --filter, the help message shows the same example:

with self.argument_context('ad') as c:

c.argument('query_filter', options_list=['--filter'], help='OData filter, e.g. --filter "displayname eq \'test\' and servicePrincipalType eq \'Application\'"')

The current example --filter "displayname eq 'test' and servicePrincipalType eq 'Application'" only works for az ad sp list, but doesn't work for

  • az ad app list
  • az ad app permission list-grants
  • az ad user list
  • az ad group list

This PR updates the help message of --filter to a generic one that suits all commands that supports --filter.

@ghost ghost requested a review from yonzhan January 19, 2023 07:07
@ghost ghost added the Auto-Assign Auto assign by bot label Jan 19, 2023
@ghost ghost requested a review from wangzelin007 January 19, 2023 07:07
@ghost ghost assigned jiasli Jan 19, 2023
@ghost ghost added this to the Jan 2023 (2023-02-07) milestone Jan 19, 2023
@ghost ghost added the Graph (doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad label Jan 19, 2023
@ghost ghost requested review from calvinhzy and evelyn-ys January 19, 2023 07:07
Comment on lines +238 to +239
help='The $filter OData query parameter to retrieve a subset of a collection. '
'For more information, see https://learn.microsoft.com/graph/filter-query-parameter')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This topic is quite similar to the one we are having on --query: #24633 (comment), #24332 (comment). That is, whether we want to provide concrete examples for generic arguments in each command.

Comment on lines +238 to +239
help='The $filter OData query parameter to retrieve a subset of a collection. '
'For more information, see https://learn.microsoft.com/graph/filter-query-parameter')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing is how we can better convey that quoting rules should be considered in different shells. Especially, when there are spaces in the value, the value should be quoted.

Currently --query doesn't mention quoting rules.

    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                         examples.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Jan 19, 2023

Update --filter help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad Auto-Assign Auto assign by bot Graph (doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants